/*
C bindings for the FMod event engine
Copyright (C) 2007 David Wallin

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef __FMOD_EVENT_C_H__
#define __FMOD_EVENT_C_H__

#include <fmod/fmod.hpp>
#include <fmod/fmod.h>
#include <fmod/fmod_event.h>
#include <fmod/fmod_errors.h>

#ifdef __DLL_ACTION__
    #undef __DLL_ACTION__
#endif // __DLL_ACTION__

#ifdef __BUILD_FMOD_EVENT_C_H__
    #define __DLL_ACTION__ dllexport
#else // __BUILD_FMOD_EVENT_C_H__
    #define __DLL_ACTION__ dllimport
#endif // __BUILD_FMOD_EVENT_C_H__


/*
FMOD types.
*/

typedef struct FMOD_EVENTSYSTEM         FMOD_EVENTSYSTEM;
typedef struct FMOD_EVENTCATEGORY       FMOD_EVENTCATEGORY;
typedef struct FMOD_EVENTPROJECT        FMOD_EVENTPROJECT;
typedef struct FMOD_EVENTGROUP          FMOD_EVENTGROUP;
typedef struct FMOD_EVENT               FMOD_EVENT;
typedef struct FMOD_EVENTPARAMETER      FMOD_EVENTPARAMETER;
typedef struct FMOD_EVENTREVERB         FMOD_EVENTREVERB;


/*
    FMOD Event System factory function.  Use this to create an FMOD Event System Instance.  below you will see FMOD_EventSystem_Init/Release to get started.
*/

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Create                  (FMOD_EVENTSYSTEM **system);


/*
    'EventSystem' API
*/

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Init                    (FMOD_EVENTSYSTEM *system, int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata, EVENT_INITFLAGS eventflags = EVENT_INIT_NORMAL);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Release                 (FMOD_EVENTSYSTEM *system);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Update                  (FMOD_EVENTSYSTEM *system);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_SetMediaPath            (FMOD_EVENTSYSTEM *system, const char *path);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_SetPluginPath           (FMOD_EVENTSYSTEM *system, const char *path);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetVersion              (FMOD_EVENTSYSTEM *system, unsigned int *version);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetInfo                 (FMOD_EVENTSYSTEM *system, FMOD::EVENT_SYSTEMINFO *info);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetSystemObject         (FMOD_EVENTSYSTEM *system, FMOD_SYSTEM **f_system);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Load                    (FMOD_EVENTSYSTEM *system, const char *filename, FMOD::EVENT_LOADINFO *loadinfo, FMOD_EVENTPROJECT **project);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Unload                  (FMOD_EVENTSYSTEM *system);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetProject              (FMOD_EVENTSYSTEM *system, const char *name, FMOD_EVENTPROJECT **project);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetProjectByIndex       (FMOD_EVENTSYSTEM *system, int index,        FMOD_EVENTPROJECT **project);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetNumProjects          (FMOD_EVENTSYSTEM *system, int *numprojects);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetCategory             (FMOD_EVENTSYSTEM *system, const char *name, FMOD_EVENTCATEGORY **category);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetCategoryByIndex      (FMOD_EVENTSYSTEM *system, int index,        FMOD_EVENTCATEGORY **category);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetNumCategories        (FMOD_EVENTSYSTEM *system, int *numcategories);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetReverb               (FMOD_EVENTSYSTEM *system, const char *name, FMOD_EVENTREVERB **reverb);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetReverbByIndex        (FMOD_EVENTSYSTEM *system, const int index,  FMOD_EVENTREVERB **reverb);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetNumReverbs           (FMOD_EVENTSYSTEM *system, int *numreverbs);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetGroup                (FMOD_EVENTSYSTEM *system, const char *name, bool cacheevents, FMOD_EVENTGROUP **group);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetEvent                (FMOD_EVENTSYSTEM *system, const char *name, EVENT_MODE mode, FMOD_EVENT **event);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetEventBySystemID      (FMOD_EVENTSYSTEM *system, unsigned int systemid, EVENT_MODE mode, FMOD_EVENT **event);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_GetNumEvents            (FMOD_EVENTSYSTEM *system, int *numevents);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Set3DNumListeners       (FMOD_EVENTSYSTEM *system, int numlisteners);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Get3DNumListeners       (FMOD_EVENTSYSTEM *system, int *numlisteners);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Set3DListenerAttributes (FMOD_EVENTSYSTEM *system, int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_Get3DListenerAttributes (FMOD_EVENTSYSTEM *system, int listener, FMOD_VECTOR *pos, FMOD_VECTOR *vel, FMOD_VECTOR *forward, FMOD_VECTOR *up);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_RegisterMemoryFSB       (FMOD_EVENTSYSTEM *system, const char *filename, void *fsbdata, unsigned int fsbdatalen);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventSystem_UnregisterMemoryFSB     (FMOD_EVENTSYSTEM *system, const char *filename);


/*
    'EventProject' API
*/

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_Release                (FMOD_EVENTPROJECT *project);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_GetInfo                (FMOD_EVENTPROJECT *project, int *index, char **name);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_GetGroup               (FMOD_EVENTPROJECT *project, const char *name, bool cacheevents, FMOD_EVENTGROUP **group);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_GetGroupByIndex        (FMOD_EVENTPROJECT *project, int index,        bool cacheevents, FMOD_EVENTGROUP **group);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_GetNumGroups           (FMOD_EVENTPROJECT *project, int *numgroups);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_GetEvent               (FMOD_EVENTPROJECT *project, const char *name, EVENT_MODE mode, FMOD_EVENT **event);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_GetEventByProjectID    (FMOD_EVENTPROJECT *project, unsigned int projectid, EVENT_MODE mode, FMOD_EVENT **event);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventProject_GetNumEvents           (FMOD_EVENTPROJECT *project, int *numevents);


/*
    'EventGroup' API
*/

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetInfo                  (FMOD_EVENTGROUP *group, int *index, char **name);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_LoadEventData            (FMOD_EVENTGROUP *group, FMOD::EVENT_RESOURCE, EVENT_MODE mode);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_FreeEventData            (FMOD_EVENTGROUP *group, FMOD_EVENT *event = 0);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetGroup                 (FMOD_EVENTGROUP *source_group, const char *name, bool cacheevents, FMOD_EVENTGROUP **target_group);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetGroupByIndex          (FMOD_EVENTGROUP *source_group, int index,        bool cacheevents, FMOD_EVENTGROUP **target_group);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetParentGroup           (FMOD_EVENTGROUP *source_group, FMOD_EVENTGROUP **target_group);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetParentProject         (FMOD_EVENTGROUP *group, FMOD_EVENTPROJECT **project);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetNumGroups             (FMOD_EVENTGROUP *group, int *numgroups);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetEvent                 (FMOD_EVENTGROUP *group, const char *name, EVENT_MODE mode, FMOD_EVENT **event);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetEventByIndex          (FMOD_EVENTGROUP *group, int index,        EVENT_MODE mode, FMOD_EVENT **event);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetNumEvents             (FMOD_EVENTGROUP *group, int *numevents);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetProperty              (FMOD_EVENTGROUP *group, const char *propertyname, void *value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetPropertyByIndex       (FMOD_EVENTGROUP *group, int propertyindex, void *value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventGroup_GetNumProperties         (FMOD_EVENTGROUP *group, int *numproperties);


/*
    'EventCategory' API
*/
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetInfo               (FMOD_EVENTCATEGORY *category, int *index, char **name);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetCategory           (FMOD_EVENTCATEGORY *source_category, const char *name, FMOD_EVENTCATEGORY **target_category);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetCategoryByIndex    (FMOD_EVENTCATEGORY *source_category, int index,        FMOD_EVENTCATEGORY **target_category);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetNumCategories      (FMOD_EVENTCATEGORY *category, int *numcategories);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_StopAllEvents         (FMOD_EVENTCATEGORY *category);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_SetVolume             (FMOD_EVENTCATEGORY *category, float volume);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetVolume             (FMOD_EVENTCATEGORY *category, float *volume);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_SetPitch              (FMOD_EVENTCATEGORY *category, float pitch);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetPitch              (FMOD_EVENTCATEGORY *category, float *pitch);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_SetPaused             (FMOD_EVENTCATEGORY *category, bool paused);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetPaused             (FMOD_EVENTCATEGORY *category, bool *paused);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_SetMute               (FMOD_EVENTCATEGORY *category, bool mute);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetMute               (FMOD_EVENTCATEGORY *category, bool *mute);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventCategory_GetChannelGroup       (FMOD_EVENTCATEGORY *category, FMOD_CHANNELGROUP **channelgroup);

/*
    'Event' API
*/

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_Start                         (FMOD_EVENT *event);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_Stop                          (FMOD_EVENT *event, bool immediate = false);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetInfo                       (FMOD_EVENT *event, int *index, char **name, FMOD::EVENT_INFO *info);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetState                      (FMOD_EVENT *event, EVENT_STATE *state);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetParentGroup                (FMOD_EVENT *event, FMOD_EVENTGROUP **group);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetChannelGroup               (FMOD_EVENT *event, FMOD_CHANNELGROUP **channelgroup);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_SetCallback                   (FMOD_EVENT *event, FMOD::EVENT_CALLBACK callback, void *userdata);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetParameter                  (FMOD_EVENT *event, const char *name, FMOD_EVENTPARAMETER **parameter);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetParameterByIndex           (FMOD_EVENT *event, int index, FMOD_EVENTPARAMETER **parameter);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetNumParameters              (FMOD_EVENT *event, int *numparameters);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetProperty                   (FMOD_EVENT *event, const char *propertyname, void *value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetPropertyByIndex            (FMOD_EVENT *event, int propertyindex, void *value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetNumProperties              (FMOD_EVENT *event, int *numproperties);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetCategory                   (FMOD_EVENT *event, FMOD_EVENTCATEGORY **category);

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_SetVolume                     (FMOD_EVENT *event, float volume);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetVolume                     (FMOD_EVENT *event, float *volume);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_SetPitch                      (FMOD_EVENT *event, float pitch);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetPitch                      (FMOD_EVENT *event, float *pitch);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_SetPaused                     (FMOD_EVENT *event, bool paused);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetPaused                     (FMOD_EVENT *event, bool *paused);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_SetMute                       (FMOD_EVENT *event, bool mute);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetMute                       (FMOD_EVENT *event, bool *mute);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_Set3DAttributes               (FMOD_EVENT *event, const FMOD_VECTOR *position, const FMOD_VECTOR *velocity, const FMOD_VECTOR *orientation = 0);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_Get3DAttributes               (FMOD_EVENT *event, FMOD_VECTOR *position, FMOD_VECTOR *velocity, FMOD_VECTOR *orientation = 0);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_Set3DOcclusion                (FMOD_EVENT *event, float directocclusion, float reverbocclusion);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_Get3DOcclusion                (FMOD_EVENT *event, float *directocclusion, float *reverbocclusion);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_SetReverbProperties           (FMOD_EVENT *event, const FMOD_REVERB_CHANNELPROPERTIES *prop);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_Event_GetReverbProperties           (FMOD_EVENT *event, FMOD_REVERB_CHANNELPROPERTIES *prop);


/*
    'EventParameter' API
*/

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_GetInfo              (FMOD_EVENTPARAMETER *parameter, int *index, char **name);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_GetRange             (FMOD_EVENTPARAMETER *parameter, float *rangemin, float *rangemax);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_SetValue             (FMOD_EVENTPARAMETER *parameter, float value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_GetValue             (FMOD_EVENTPARAMETER *parameter, float *value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_SetVelocity          (FMOD_EVENTPARAMETER *parameter, float value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_GetVelocity          (FMOD_EVENTPARAMETER *parameter, float *value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_SetSeekSpeed         (FMOD_EVENTPARAMETER *parameter, float value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_GetSeekSpeed         (FMOD_EVENTPARAMETER *parameter, float *value);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventParameter_KeyOff               (FMOD_EVENTPARAMETER *parameter);


/*
    'EventReverb' API
*/

FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventReverb_Release                 (FMOD_EVENTREVERB *reverb);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventReverb_SetProperties           (FMOD_EVENTREVERB *reverb, FMOD_REVERB_PROPERTIES *props);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventReverb_GetProperties           (FMOD_EVENTREVERB *reverb, FMOD_REVERB_PROPERTIES *props);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventReverb_SetActive               (FMOD_EVENTREVERB *reverb, bool active);
FMOD_RESULT __declspec(__DLL_ACTION__) __cdecl FMOD_EventReverb_GetInfo                 (FMOD_EVENTREVERB *reverb, int *index, char **name);


#endif // __FMOD_EVENT_C_H__
